layui
  .extend({
    setter: "config",
    admin: "admin",
    view: "view"
  })
  .define(["setter", "admin"], function(a) {
    var e = layui.setter,
      i = layui.element,
      n = layui.admin,
      t = n.tabsPage,
      d = layui.view,
      l = function(a, d) {
        var l,
          b = r("#TMM_app_tabsheader>li"),
          y = a.replace(/(^http(s*):)|(\?[\s\S]*$)/g, "");
        if (
          (b.each(function(e) {
            var i = r(this),
              n = i.attr("lay-id");
            n === a && ((l = !0), (t.index = e));
          }),
          (d = d || "新标签页"),
          e.pageTabs)
        )
          l ||
            (r(s).append(
              [
                '<div class="tmm-admin-tabsbody-item layui-show">',
                '<iframe src="' +
                  a +
                  '" frameborder="0" class="tmm-admin-iframe"></iframe>',
                "</div>"
              ].join("")
            ),
            (t.index = b.length),
            i.tabAdd(o, {
              title: "<span>" + d + "</span>",
              id: a,
              attr: y
            }));
        else {
          var u = n.tabsBody(n.tabsPage.index).find(".tmm-admin-iframe");
          u[0].contentWindow.location.href = a;
        }
        i.tabChange(o, a),
          n.tabsBodyChange(t.index, {
            url: a,
            text: d
          });
      },
      s = "#TMM_app_body",
      o = "tmm-admin-layout-tabs",
      r = layui.$;
    r(window);
    n.screen() < 2 && n.sideFlexible(),
      layui.config({
        base: e.base + ""
      }),
      layui.each(e.extend, function(a, i) {
        var n = {};
        (n[i] = "{/}" + e.base + "lib/layui/extend/" + i), layui.extend(n);
      }),
      d().autoRender(),
      a("index", {
        openTabsPage: l
      });
  });
